import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CustomStyleBg extends StatelessWidget {
  const CustomStyleBg({
    super.key,
    this.width,
    this.height,
    this.borderRadius,
    this.borderWidth,
    this.borderWidthRate,
    this.borderColor,
    this.color,
    this.margin,
    this.padding,
    this.alignment,
    this.child,
  });

  final double? width;
  final double? height;
  final double? borderRadius;
  final double? borderWidth;
  final double? borderWidthRate;
  final Color? borderColor;
  final Color? color;
  final EdgeInsetsGeometry? margin;
  final EdgeInsetsGeometry? padding;
  final AlignmentGeometry? alignment;
  final Widget? child;

  @override
  Widget build(BuildContext context) {
    var normalSide = BorderSide(
      width: borderWidth ?? 1.w,
      color: borderColor ?? Colors.black,
    );
    var bottomSide = BorderSide(
      width: (borderWidth ?? 1.w) * (borderWidthRate ?? 2),
      color: borderColor ?? Colors.black,
    );
    return Container(
      width: width,
      height: height,
      margin: margin,
      padding: padding,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(borderRadius ?? (height ?? 10) / 2),
        border: Border(
          top: normalSide,
          left: normalSide,
          right: normalSide,
          bottom: bottomSide,
        ),
        color: color ?? const Color(0xffDFFF32),
      ),
      alignment: alignment ?? Alignment.center,
      clipBehavior: Clip.antiAlias,
      child: child,
    );
  }
}
